package com.h.ssRoom.repo;

<<<<<<< HEAD
import java.sql.Date;
=======
import java.sql.Timestamp;
>>>>>>> 71d11a30821e4a369fe163d5c0d88106681576b3
import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.h.ssRoom.model.Appoints;

public interface AppointsRepo extends JpaRepository<Appoints, Integer>{
    //根据顾客编号查询预约订单
    @Query(value = "select * from appoints where customerID=?1", nativeQuery = true)
    public List<Appoints> getAppointsByID(String customerID);
    
    //根据顾客编号插入预约订单
    @Transactional
    @Modifying
<<<<<<< HEAD
    @Query(value = "update appoints set customerid=?1,ss_roomID=?2,seatID=?3,start_time=?4,study_len=?5", nativeQuery = true)
    public List<Appoints> insertAppointsByID(String customerID,Integer ssRoomID,Integer seatID,Date startTime,Integer studyLen); 
    
    //根据用户编号获取学习记录
//    @Query(value = "select * from appoints where customerid = ?1",nativeQuery = true)
//    public List<Appoints> studyRecord(String customerID);
=======
    @Query(value = "insert into appoints(customerid,ss_roomID,seatID,start_time,study_len) values(?1,?2,?3,?4?5)", nativeQuery = true)
    public List<Appoints> insertAppointsByID(String customerID,Integer ssRoomID,Integer seatID,Timestamp startTime,Integer studyLen); 

    
    //根据用户编号获取学习记录
    @Query(value = "select * from appoints where customerid = ?1",nativeQuery = true)
    public List<Appoints> studyRecord(String customerID);

    //根据自习室座位编号查找
    @Query(value = "select * from appoints where ssRoomID = ?1 and seatID = ?2",nativeQuery = true)
    public List<Appoints> getAppointsByssRoomIDAndseatID(Integer ssRoomID,Integer seatID);

//    //根据用户编号获取学习记录
//    @Query(value = "select * from appoints where customerid = ?1",nativeQuery = true)
//    public List<Appoints> studyRecord(String customerID);

>>>>>>> 71d11a30821e4a369fe163d5c0d88106681576b3
}
